<?php
class A
{
    private static $inst=null;

    private function __construct()
    {
    }

    public static function init()
    {
        if(self::$inst == null)
            self::$inst=new A();
    }

    public static function getInstance()
    {
        return self::$inst;
    }

    private $s;

    public function hello($s='')
    {
        $this->s=$s;
        printf("hello %s\n", $this->s);
    }
}

A::init();
$a=A::getInstance();
$a->hello("Tom");
?>
